(function (_super) {
    function ResultPVE(data) {
        ResultPVE.super(this);

        this.headerUI = null;
        this.contentUI = null;

        this.init(data);
    }
    Laya.class(ResultPVE, "Com.Result.PVE", _super);
    var _proto = ResultPVE.prototype;
    _proto.destroy = function () {
        _super.prototype.destroy.call(this, true);

        this.headerUI = null;
        this.contentUI = null;
    }

    _proto.init = function (data) {
        this.size(1000, 340);
        this.alpha = 0;
        this.centerX = 0;
        this.y = Laya.stage.height / 2;

        this.create();
        this.update(data);
    }
    _proto.create = function () {
            
        var headerUI = new Laya.Image("res/result/pve_title.png");
            headerUI.centerX = 0;

        var contentUI = new ui.Result.PVEResultUI();
            contentUI.centerX = 0;
            contentUI.y = 56;

        var mask = new Laya.Sprite();
            mask.loadImage("res/public/avatar_mask.png", 0, 0, contentUI.avatar.width, contentUI.avatar.height);

        contentUI.avatar.mask = mask;

        this.headerUI = headerUI;
        this.contentUI = contentUI;
        this.addChildren(headerUI, contentUI);            
    }
    _proto.update = function (data) {
        var contentUI = this.contentUI;

        contentUI.avatar.skin = data.avatar == "" ? USER_DEFAULT_AVATAR : data.avatar;

        contentUI.userName.text = data.userName;
        contentUI.lv.text = "lv:" + data.lvl;
        contentUI.exp.text = "e+" + data.experience;
        contentUI.coin.text = "+" + data.money;
        contentUI.chip.text = "+" + data.chip;

        contentUI.iconChip.skin = PROPS_PATH + data.drop + ".png";
    }
    _proto.enter = function () {
        Laya.Tween.to(this, {y : Laya.stage.height / 2 - 130, alpha : 1}, 100);
    }
    _proto.resize = function (height) {
        Laya.Tween.clearAll(this);

        this.alpha = 1;
        this.y = height / 2 - 130;
    }

})(Laya.Box);